public class TestMemModel {
    public static void main(String[] args) {
        mem02();
    }

    public static void mem02() {
        Person p1 = new Person();
        p1.name = "张三";
        Person p2 = new Person();
        p2.name = "李四";

        p1.name = "王五";
        p1.show();
        p2.show();
        Person p3 = p1;
        p3.name = "小明";
        p1.show();
        p2 = p1;
        p1.show();
        p2.show();
        p3.show();
    }

    public static void mem01() {
        Person p = new Person();
        p.name = "张三";
        p.show();
        int a = 10;
        int b = a ;
        b = 20;
        System.out.println(a+","+b);
        Person p2 = p;
        p2.name = "李四";
        p2.show();
        p.show();
    }
}

class Person {
    String name;

    public void show() {
        System.out.println(name);
    }
}
